cmake_minimum_required(VERSION 3.16)
project(galang_parser)

set(CMAKE_C_COMPILER g++)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")

include_directories(include)
include_directories(../third_party)

add_library(parser SHARED
    src/lexer.cpp
    src/parser.cpp
    src/ast.cpp
    src/visitor.cpp
    src/codegen.cpp
    src/symtable.cpp
    src/codeobj.cpp
    src/type.cpp
    src/typechecker.cpp
    src/typed_ast.cpp
    src/generic_cleaner.cpp
)

add_executable(gsc src/gsc.cpp)
target_link_libraries(gsc PUBLIC parser)

# test
add_executable(test_parser 
    test/test_main.cpp
    test/test_stmts.cpp
)
target_link_libraries(test_parser PUBLIC parser)
